package cn.school.servlet.filter;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

/**
 * @author oldliu
 * @since 1.0
 */
@WebListener
public class SchoolSessionSet implements HttpSessionAttributeListener {
    @Override
    public void attributeAdded(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("session中加入了新值："+httpSessionBindingEvent.getName()+":"+httpSessionBindingEvent.getValue());
    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("session中删除了："+httpSessionBindingEvent.getName()+":"+httpSessionBindingEvent.getValue());
    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("session中替换了老值："+httpSessionBindingEvent.getName()+":"+httpSessionBindingEvent.getValue());
    }
}
